﻿<?php
$this->breadcrumbs=array(
	'Status',
);?>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/userstatus.css" />

<script type='text/javascript' src="<?php echo Yii::app()->theme->baseUrl; ?>/fullCalendar/fullcalendar/fullcalendar.js"></script>
<link rel='stylesheet' type='text/css' href="<?php echo Yii::app()->theme->baseUrl; ?>/css/jquery-ui-1.8.14.custom.css" />
<script type='text/javascript' src="<?php echo Yii::app()->theme->baseUrl; ?>/fullCalendar/jquery/jquery-ui-1.8.11.custom.min.js"></script>
<script type='text/javascript' src="<?php echo Yii::app()->theme->baseUrl; ?>/js/jquery.ui.datepicker.js"></script>

<script type = 'text/javascript'>
	$(document).ready(function(){
		$("#freedate").datepicker(
			{
			defaultDate: "+1w",
			dateFormat: 'yy-mm-dd',
			changeMonth: true,
			numberOfMonths: 1,
			showOn: 'both',
			buttonImageOnly: true,
			changeMonth: true,
			buttonText:'Select date',
			buttonImage: "<?php echo Html::imageUrl('icon_calendar.gif');?>"	
			}
		);
		
		$("#status_update").click(function(){
			var status = $("#user_status_id").val();
			var freedate = $("#freedate").val();
			var timeAday = $("#status_timeDay").val();
			
			$('#status_projAvail').html(status);
			$('#status_freedate').html(freedate);
			$('#status_timeAday').html(timeAday);
			$.fancybox.close();
			
		});
	});
</script>


            <div class="padding10"></div>   
            <!-- Begin rightSidebar -->
				<div id="contentWrapper">
					<div id = "rightWrapper">
						<div class = "user_status"><span class = "status_label">Khả năng nhận dự án</span><span id = "status_projAvail"> <?php if($user_status->user_status_idle == '1' ){ echo 'Có';} else echo 'Không';?></span></div>
						<div class = "user_status"><span class = "status_label">Thời gian rảnh </span><span id ="status_freedate"><?php echo $user_status->user_status_free_period; ?></span></div>
						<div class = "user_status"><span class = "status_label">Thời gian làm / ngày</span><span id ="status_timeAday"><?php echo $user_status->user_hour_per_day;?></span> giờ</div>
						
					</div>
					<button type="button" id = "edit_status" href="#edit_statusDiv" >Sửa</button>
					<div style="margin-top:15px;margin-left:20px"></div>
				</div>	
				
		<!-- Edit status-->
		<div id = "edit_statusPopup" style= "display: none" >
			<div id = "edit_statusDiv" class="popupWrapper">
				<div class = "popupHeader">
					<h3>Trạng Thái Làm Việc</h3>
				</div>
				<?php $form = $this->beginWidget('CActiveForm'); ?>
				<div class= "popupContent">
					<div class = "user_statusEdit"><span class = "status_labelEdit">Khả năng nhận dự án</span> 
						
						<?php echo $form->dropDownList($user_status,'user_status_idle',array('1'=>'Có','0'=>'Không'),array('id'=>'user_status_id'));?>	
					
					</div>
					<div class = "user_statusEdit"><span class = "status_labelEdit">Thời gian rảnh </span> 
						<?php echo $form->textField($user_status,'user_status_free_period',array('id'=>'freedate')); ?>
						
					</div>
					
				
					<div class = "user_statusEdit"><span class = "status_labelEdit">Thời gian làm /ngày </span>
						<?php echo $form->textField($user_status,'user_hour_per_day',array('id'=>'status_timeDay'));?> giờ
					</div>	
					<?php echo CHtml::submitButton('Lưu',array('id'=>'status_update'));?>
					
				</div>
				<?php $this->endWidget();?>
			</div>
		</div>
<?php  $this->widget('application.extensions.fancybox.EFancyBox', array( 'target'=>'button#edit_status', 'config'=>array( 'scrolling' => 'no', 'titleShow' => false, 'hideOnOverlayClick' =>false ), ) ); ?>
			